<template>
  <div class="newsDetail-container">
    <div class="newsDetail-content">
      <h3 class="newsDetail-title">{{newsInfo.Title}}</h3>
      <P class="newsDetail-subtitle">
        <span>发表时间：{{newsInfo.CreatedAt}}</span>
        <span>阅读量：{{newsInfo.ReadCount}}</span>
      </P>
      <div class="newsDetail-text">
        <p v-html="newsInfo.Content"></p>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        newsId: '',
        newsInfo: {},
      }
    },
    methods: {
      async newsDetail() {
        const result = await this.$get("/api/News/" + this.newsId)
        this.newsInfo = result;
      }
    },
    created() {
      this.newsId = this.$route.params.newsId;
      this.newsDetail();
    }
  }

</script>

<style lang="scss" scoped>
  .newsDetail-container {
    height: auto;
    width: 100%;
  }

  .newsDetail-content {
    height: 760px;
    width: 100%;
    padding: 30px 15px;
    border: 1px solid #bbdbf7;
    margin-bottom: 15px;
    overflow-y: auto;
    .newsDetail-title {
      width: 100%;
      margin-bottom: 30px;
      display: flex;
      justify-content: center;
      font-size: 16px;
      color: #003366;
    }
    .newsDetail-subtitle {
      display: flex;
      justify-content: center;
      margin-bottom: 15px;
      span {
        font-size: 12px;
        margin-right: 20px;
      }
    }
  }
</style>